﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WOS.Logging
{
    public sealed class LogEntry
    {
        #region Private Fields
        private readonly DateTime date;
        private readonly LogSource source;
        private readonly LogLevel level;
        private readonly int thread;
        private readonly string content;
        private readonly LogAttachmentInfo[] attachments;
        #endregion
        #region Constructors
        internal LogEntry(DateTime date, LogSource source, LogLevel level, int thread, string content, LogAttachmentInfo[] attachments)
        {
            this.date = date;
            this.source = source;
            this.level = level;
            this.thread = thread;
            this.content = content;
            this.attachments = attachments;
        }
        #endregion

        #region Public Members
        public DateTime Date
        {
            get { return this.date; }
        }

        public LogSource Source
        {
            get { return this.source; }
        }

        public LogLevel Level
        {
            get { return this.level; }
        }

        public string Content
        {
            get { return this.content; }
        }

        public int Thread
        {
            get { return this.thread; }
        }

        public int AttachmentsCount
        {
            get { return this.attachments.Length; }
        }

        public LogAttachmentInfo[] GetAttachments()
        {
            return this.attachments.ToArray();
        }
        #endregion
    }
}
